package team.lourd.network.system.config;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import team.lourd.network.system.quartz.ConditionDiscriminationJob;

/** 
* @Description: Quartz整合配置
* @Author: Lourd 
* @Date: 2019/1/17 
*/
@Configuration
public class QuartzConfig {
    @Bean
    public JobDetail modelInspectJobDetail() {
        return JobBuilder.newJob(ConditionDiscriminationJob.class).withIdentity("modelInspectJob").storeDurably().build();
    }

    @Bean
    public Trigger uploadTaskTrigger() {
        CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("*/30 * * * * ?");
        return TriggerBuilder.newTrigger().forJob(modelInspectJobDetail())
                .withIdentity("modelInspectJob")
                .withSchedule(scheduleBuilder)
                .build();
    }
}